package teach;

public class Test_1 {
    public static void main(String[] args) {

        A a[]=new A[3];
        a[0]=new B("fa",31);

    }
}

class A{
    private String name;
    private int age;

    public A(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }
}
class B extends A{
    public B(String name, int age) {
        super(name, age);
    }

    @Override
    public String toString() {
        return "B{}";
    }
}